feat(sync): add a race-safe outbound controller#137
Open
marcus-pousette wants to merge 1 commit into
Open
Conversation
This was referenced May 5, 2026
d7c5bb6 to
edcaec2
Compare
7821011 to
b1b50a2
Compare
This was referenced Jul 12, 2026
b1b50a2 to
46cf7ac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds
createOutboundSync, an application-facing controller that publishes exact committed local operations through oneSyncPeerand one or more outbound transports.Applications report a local edit once with
queueOps(...). The controller deduplicates pending operations by operation ID, wakes low-level live subscriptions, and keeps exact uploads queued until a target is available and online.Correctness guarantees
SyncPeer.pushOps; signing or later chunks cannot continue after the controller retries.flush()callers share one drain barrier, including work queued during the active run.close()aborts active work, clears the queue, and prevents late restoration.Clean integration with #191
This PR is stacked on #191 and preserves its per-exchange Hello correlation, transport-owned state, and exact capability leases. It does not restore the removed global
waitForAck/Hello-waiter path or add a compatibility adapter.Fast paths and limits
meta.id.send()already began; later frames and session continuation are stopped, and operation IDs make a late valid frame idempotent.Size
The cohesive layer is 8 files, +984/-38. Playground adoption, discovery, UI, lockfile churn, and unrelated op-ref behavior remain outside this PR.
Validation
@treecrdt/sync: 32/32